import React, { useState } from 'react';
import Child from './Child'
function App(){
    let [list,setList] = useState([
        "李亚磊","王青松","韩家长","李文龙","刘亚伟"
    ])
    let [num,setNum] = useState(0)
    return (
        <div>
            <h1>React.memo性能优化---{num}</h1>
            <button onClick={()=>{
                setNum(num+1)
            }}>++</button>
            <ol>
                {
                    list.map((item,index)=>{
                        return <Child key={index} item={item}></Child>
                    })
                }
            </ol>
            <button onClick={()=>{
              let newList = [...list];
              newList[0] = '党玉杰'
              setList(newList)
            }}>改变</button>
        </div>
    )
}
export default App;